clear;

loaddata=2

switch loaddata
    case 2
        cd 'C:\_bcoe\data_eyelink2\_C_DATA'
        load eyelink_l.mat
        fig_adj=20; fig_names='EyeLab data (long)';
    case 3
        cd 'C:\_bcoe\data_eyelink2\_C_DATA'
        load eyelink_s.mat
        eyelink=eyelink2;
        fig_adj=30;fig_names='EyeLab data (short)';        
    case 4
        cd 'C:\_bcoe\data_eyelink2\_C_DATA'
        load eyelink_all.mat
        fig_adj=40;fig_names='EyeLab data (all)';        
    case 1        
        cd 'C:\_London fMRI Data\C_data'
        load london.mat
        eyelink=london;
        fig_adj=10;fig_names='fMRI data (long)';
end
% subject2 is DM @ 504
% subject7 is rk @ 504

    m_pro_srr=[];%(find(i==files))=mean(london.rank_srt(london.filenum==i & london.anti==0))
    m_anti_srr=[];%(find(i==files))=mean(london.rank_srt(london.filenum==i & london.anti==1))
    m_pro_srt=[];%(find(i==files))=mean(london.srt(london.filenum==i & london.anti==0))
    m_anti_srt=[];%(find(i==files))=mean(london.srt(london.filenum==i & london.anti==1))

fig(8);clf
for j=unique(eyelink.subjectnum)'
     m_pro_cent_srt(j,1)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==0 ));
     m_pro_cent_srt(j,2)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==0 & eyelink.delay==0.0));
     m_pro_cent_srt(j,3)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==0 & eyelink.delay==0.5));
     m_pro_cent_srt(j,4)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==0 & eyelink.delay==1.0));

     m_anti_cent_srt(j,1)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==1 ));
     m_anti_cent_srt(j,2)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==1 & eyelink.delay==0.0));
     m_anti_cent_srt(j,3)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==1 & eyelink.delay==0.5));
     m_anti_cent_srt(j,4)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==0 & eyelink.anti==1 & eyelink.delay==1.0));

     m_pro_peri_srt(j,1)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==0 ));
     m_pro_peri_srt(j,2)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==0 & eyelink.delay==0.0));
     m_pro_peri_srt(j,3)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==0 & eyelink.delay==0.5));
     m_pro_peri_srt(j,4)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==0 & eyelink.delay==1.0));

     m_anti_peri_srt(j,1)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==1 ));
     m_anti_peri_srt(j,2)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==1 & eyelink.delay==0.0));
     m_anti_peri_srt(j,3)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==1 & eyelink.delay==0.5));
     m_anti_peri_srt(j,4)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.peri==1 & eyelink.anti==1 & eyelink.delay==1.0));

%      e_pro_srt(j,1)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 ));
%      e_pro_srt(j,2)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 & eyelink.delay==0.0));
%      e_pro_srt(j,3)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 & eyelink.delay==0.5));
%      e_pro_srt(j,4)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 & eyelink.delay==1.0));
% 
%      e_anti_srt(j,1)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 ));
%      e_anti_srt(j,2)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==0.0));
%      e_anti_srt(j,3)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==0.5));
%      e_anti_srt(j,4)=ste(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==1.0));
     
     subplot(4,2,j);cla; hold on; xlim([.5 4.5]);ylim([350 600])
     bar([1:4],[m_pro_cent_srt(j,:); m_pro_peri_srt(j,:); m_anti_cent_srt(j,:); m_anti_peri_srt(j,:) ]');
%      errorbar([1:4]-.15,[m_pro_srt(j,:)],[e_pro_srt(j,:)],'b')
%      errorbar([1:4]+.15,[m_anti_srt(j,:)],[e_anti_srt(j,:)],'r')
 end
(m_anti_cent_srt-m_pro_cent_srt)./(m_anti_cent_srt+m_pro_cent_srt)
 m_anti_peri_srt-m_pro_peri_srt
 
fig(10);clf;
subplot(2,1,1)
boxplot(m_anti_cent_srt-m_pro_cent_srt,0)
hline(0)
subplot(2,1,2)
boxplot(m_anti_peri_srt-m_pro_peri_srt,0)
hline(0)
 
%  BOXPLOT Display boxplots of a data sample.
%     BOXPLOT(X,NOTCH,SYM,VERT,WHIS) produces a box and whisker plot for
%     each column of X. The box has lines at the lower quartile, median, 
%     and upper quartile values. The whiskers are lines extending from 
%     each end of the box to show the extent of the rest of the data. 
%     Outliers are data with values beyond the ends of the whiskers.
%  
%     NOTCH = 1 produces a notched-box plot. Notches represent a robust 
%     estimate of the uncertainty about the medians for box to box comparison.
%     NOTCH = 0 (default) produces a rectangular box plot. 
%     SYM sets the symbol for the outlier values if any (default='+'). 
%     VERT = 0 makes the boxes horizontal (default: VERT = 1, for vertical).
%     WHIS defines the maximum length of the whiskers as a function of the
%     IQR (default = 1.5).  The whisker extends to the most extreme data
%     value within WHIS*IQR of the box.  If WHIS = 0 then BOXPLOT displays
%     all data values outside the box using the plotting symbol, SYM.   
%  
%     BOXPLOT(X,G,NOTCH,...) produces a box and whisker plot for the vector
%     X grouped by G.  G is a grouping variable defined as a vector, string
%     matrix, or cell array of strings.  G can also be a cell array of 
%     several grouping variables (such as {G1 G2 G3}) to group the values
%     in X by each unique combination of grouping variable values.
%   
%     BOXPLOT calls BOXUTIL to do the actual plotting.
%  
%  
%  
 
 
 
 
 
 return
 
 
 
 
 
 
 
 
 
 
 m_anti_srt-m_pro_srt
     [h p_pro_anti_srt(j,1)]=ttest2(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 ),eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 ));
     [h p_pro_anti_srt(j,1)]=ttest2(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 & eyelink.delay==0.0),eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==0.0));
     [h p_pro_anti_srt(j,1)]=ttest2(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 & eyelink.delay==0.5));
     [h p_pro_anti_srt(j,1)]=ttest2(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==0 & eyelink.delay==1.0));

     m_anti_srt(j,1)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 ));
     m_anti_srt(j,2)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==0.0));
     m_anti_srt(j,3)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==0.5));
     m_anti_srt(j,4)=mean(eyelink.srt(eyelink.error==0 & eyelink.subjectnum==j & eyelink.anti==1 & eyelink.delay==1.0));

     
     
    fig(j);clf;hold on;
    set(gcf,'name',london.subject(j,:));
    subplot(2,1,1);
%     bar(files,[m_pro_srr;m_anti_srr]');
    axis tight;
    if sum(temp)
        vline(files(1)+.5+find(diff(temp)>0),'r');
    end
    subplot(2,1,2);
    bar(files,[m_pro_srt;m_anti_srt]');
    axis tight;
    if sum(temp)
        vline(files(1)+.5+find(diff(temp)>0),'r');
    end    
end
